package io.example;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.http.HttpClient;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.jdbc.JDBCClient;

/**
 * @author chengen
 * @date 21/04/2017
 */
public class TheVerticle extends AbstractVerticle {
	//将客户端对象与Verticle对象绑定，这里选取了三种不同的客户端作为示范
	HttpClient httpClient;
	//	WebClient webClient;
	JDBCClient jdbcClient;

	@Override
	public void start() {
		//创建客户端
		httpClient = vertx.createHttpClient();

//		webClient = WebClient.wrap(httpClient);

		JsonObject config = new JsonObject()
				.put("jdbcUrl", "...")
				.put("maximumPoolSize", 30)
				.put("username", "db user name")
				.put("password", "***")
				.put("provider_class", "...");

		jdbcClient = JDBCClient.createShared(vertx, config);

		//using clients
	}
}